package com.flca.frw.util;

/**
 * This class contains some often used system parameters.
 * This class should be initialized before the rest of the app start 
 * @author rbakkerus
 *
 */
public class Parameters {

	public static final String RUN_MODUS = "run.modus";
	public static final String SKIP_VALIDATION = "skip.validation";
	
	public static final String PRO = "P";
	public static final String DEV = "D";
	public static final String ACC = "A";
	public static final String TST = "T";
	
	public static final String USE_FRONTEND_MOCK = "useFrontendMock";
	public static final String USE_EXTSWS_MOCK = "useExternalServiceMock";
		
	private static String sRunModus; 

	private Parameters() {
	}

	public static boolean isDevModus() {
		return getRunModus().startsWith(DEV);
	}
	
	public static boolean isProdModus() {
		boolean b =  getRunModus().startsWith(PRO);
		return b;
	}

	public static String getRunModus() 
	{
		if (sRunModus == null) {
			sRunModus = System.getProperty(RUN_MODUS);
			if (sRunModus == null) {
				sRunModus = PRO;
			}
			sRunModus = sRunModus.toUpperCase();
		} 
		
		return sRunModus;
	}

	public static boolean useFrontendMock() 
	{
		String usemock = System.getProperty(USE_FRONTEND_MOCK);
		if (usemock != null && usemock.toLowerCase().startsWith("t")) {
			return true;
		} else {
			return false;
		}
	}
	
	public static boolean useExternalServiceMock() 
	{
		String usemock = System.getProperty(USE_EXTSWS_MOCK);
		if (usemock != null && usemock.toLowerCase().startsWith("t")) {
			return true;
		} else {
			return false;
		}
	}
	
	
}	
